package com.mobileagri.backoffice.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.mobileagri.backoffice.dao.UtilisateurDAO;
import com.mobileagri.backoffice.model.Utilisateur;

/**
 * Contact Service
 * 
 * @author LOUVET Romain
 */
@Service
public class UtilisateurService {

	@Autowired
	private UtilisateurDAO userDAO;

	/**
	 * Get all Message
	 * 
	 * @return
	 */
	@Transactional(readOnly = true)
	public List<Utilisateur> getUserList() {

		return userDAO.getAll();
	}

	/**
	 * Get all contacts
	 * 
	 * @return
	 */
	@Transactional(readOnly = true)
	public List<Utilisateur> getUserList(int start, int limit) {
		return userDAO.getAll(start, limit);
	}

	public Double getAvancement(String userName) {
		return userDAO.getAvancement(userName);
	}

	/**
	 * Get total of Contacts from database. Need to set this value on ExtJS
	 * Store
	 * 
	 * @return
	 */
	public int getTotalUser() {

		return userDAO.getTotal();
	}

}
